import request from '@/utils/request.js'
/**
 * 获取文章列表
 * @param {*} params
 * @returns
 */
export function getArticleList (params) {
  return request({
    url: '/v1_1/articles',
    params
  })
}
/**
 *
 * @returns 获取所以频道
 */
export function getAllChabbels () {
  return request({
    url: '/v1_0/channels'
  })
}
/**
 * 获取文章详情
 * @param {*} id 文章 id
 * @returns
 */
export function getAleticleDeatail (id) {
  return request({
    url: '/v1_0/articles/' + id
  })
}
/**
 * 删除收藏
 * @param {*} id 要删除收藏的id
 * @returns
 */
export function DeleteCollections (id) {
  return request({
    url: '/v1_0/article/collections/' + id,
    method: 'DELETE'
  })
}
/**
 * 添加收藏
 * @param {*} target 要收藏的id
 * @returns
 */
export function PostCollections (target) {
  return request({
    url: '/v1_0/article/collections',
    method: 'POST',
    data: {
      target
    }
  })
}
export function GetComments (params) {
  return request({
    url: '/v1_0/comments',
    method: 'GET',
    params
  })
}
/** 发送评论请求
 *
 * @param {*} data{target content (artId)为对评论进行评论的值}
 * @returns
 */
export function PostComment (data) {
  return request({
    url: '/v1_0/comments',
    method: 'POST',
    data
  })
}
